<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('生产型号列表')"/>
</head>
<body class="gray-bg">
<input id="modeNo" type="hidden"/>
<input id="modeName" type="hidden"/>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>生产型号：</label>
                            <input type="text" name="modeNo"/>
                        </li>
                        <li>
                            <label>型号名称：</label>
                            <input type="text" name="modeName"/>
                        </li>
                        <li>
                            <label>产品分类：</label>
                            <select name="modeType" th:with="type=${@dict.getType('erp_mode_type')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>版厚：</label>
                            <select name="thickness" th:with="type=${@dict.getType('erp_thickness')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>层数：</label>
                            <select name="layerNum" th:with="type=${@dict.getType('erp_layer_num')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>创建者：</label>
                            <input type="text" name="createBy"/>
                        </li>
                        <li class="select-time">
                            <label>创建时间：</label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="params[beginCreateTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endCreateTime]"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="erp:erpModel:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="erp:erpModel:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="erp:erpModel:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="erp:erpModel:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('erp:erpModel:edit')}]];
    var removeFlag = [[${@permission.hasPermi('erp:erpModel:remove')}]];
    var modeTypeDatas = [[${@dict.getType('erp_mode_type')}]];
    var thicknessDatas = [[${@dict.getType('erp_thickness')}]];
    var layerNumDatas = [[${@dict.getType('erp_layer_num')}]];
    var baseMaterialDatas = [[${@dict.getType('erp_baseMaterial')}]];
    var outerThicknessDatas = [[${@dict.getType('erp_outerThickness')}]];
    var innerThicknessDatas = [[${@dict.getType('erp_outerThickness')}]];
    var solderCoatingDatas = [[${@dict.getType('erp_solderCoating')}]];
    var solderColorDatas = [[${@dict.getType('erp_solderColor')}]];
    var characterColorDatas = [[${@dict.getType('erp_characterColor')}]];
    var shapingStyleDatas = [[${@dict.getType('erp_shapingStyle')}]];
    var testStyleDatas = [[${@dict.getType('erp_testStyle')}]];
    var viaHoleDatas = [[${@dict.getType('erp_viaHole')}]];
    var isImpedanceDatas = [[${@dict.getType('sys_yes_no')}]];
    var hypotenuseDatas = [[${@dict.getType('sys_yes_no')}]];
    var prefix = ctx + "erp/erpModel";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "生产型号",
            clickToSelect: true,
            onClickRow: onClickRow,
            columns: [{
                radio: true
            },
                {
                    field: 'id',
                    title: '主键ID',
                    visible: false
                },
                {
                    field: 'modeNo',
                    title: '生产型号'
                },
                {
                    field: 'modeName',
                    title: '生产型号名称'
                },
                {
                    field: 'modeType',
                    title: '产品分类',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(modeTypeDatas, value);
                    }
                },
                {
                    field: 'length',
                    title: '长度'
                },
                {
                    field: 'wide',
                    title: '宽度'
                },
                {
                    field: 'thickness',
                    title: '版厚',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(thicknessDatas, value);
                    }
                },
                {
                    field: 'layerNum',
                    title: '层数',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(layerNumDatas, value);
                    }
                },
                {
                    field: 'baseMaterial',
                    title: '基材',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(baseMaterialDatas, value);
                    }
                },
                {
                    field: 'outerThickness',
                    title: '外层铜厚',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(outerThicknessDatas, value);
                    }
                },
                {
                    field: 'innerThickness',
                    title: '内层铜厚',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(innerThicknessDatas, value);
                    }
                },
                {
                    field: 'solderCoating',
                    title: '焊盘喷镀',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(solderCoatingDatas, value);
                    }
                },
                {
                    field: 'solderColor',
                    title: '阻焊颜色',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(solderColorDatas, value);
                    }
                },
                {
                    field: 'characterColor',
                    title: '字符颜色',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(characterColorDatas, value);
                    }
                },
                {
                    field: 'shapingStyle',
                    title: '成形',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(shapingStyleDatas, value);
                    }
                },
                {
                    field: 'testStyle',
                    title: '测试',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(testStyleDatas, value);
                    }
                },
                {
                    field: 'viaHole',
                    title: '过孔',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(viaHoleDatas, value);
                    }
                },
                {
                    field: 'spec',
                    title: '规格'
                },
                {
                    field: 'unitSize',
                    title: '单元尺寸'
                },
                {
                    field: 'makeUpSize',
                    title: '拼版尺寸'
                },
                {
                    field: 'createBy',
                    title: '创建者'
                },
                {
                    field: 'createTime',
                    title: '创建时间'
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function onClickRow(row, $element) {
        $("#modeNo").val(row.modeNo);
        $("#modeName").val(row.modeName);
    }
</script>
</body>
</html>